﻿using Kanban.Api.ViewModel;
using Kanban.Entity;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace Kanban.Api.Controllers
{
    public class AtualizacoesHub : Hub
    {
        public void Entrar(int quadro)
        {
            Groups.Add(Context.ConnectionId, quadro.ToString());
        }

        public void Adicionar(Tarefa tarefa, int quadro)
        {
            //Clients.AllExcept(Context.ConnectionId).adicionar(tarefa);
            Clients.Group(quadro.ToString(), Context.ConnectionId).adicionar(tarefa);
        }

        public void Excluir(Tarefa tarefa, int quadro)
        {
            //Clients.AllExcept(Context.ConnectionId).excluir(tarefa);
            Clients.Group(quadro.ToString(), Context.ConnectionId).excluir(tarefa);
        }

        public void Mover(Tarefa tarefa, int quadro)
        {
            //Clients.AllExcept(Context.ConnectionId).mover(tarefa);
            Clients.Group(quadro.ToString(), Context.ConnectionId).mover(tarefa);
        }

        public void Editar(Tarefa tarefa, int quadro)
        {
            //Clients.AllExcept(Context.ConnectionId).editar(tarefa);
            Clients.Group(quadro.ToString(), Context.ConnectionId).editar(tarefa);
        }
    }
}
